package model

import "time"

type Model struct {
	ID        int64  `json:"id" gorm:"primary_key;column:ID"` //主键
	InDate    int64  `json:"inDate" gorm:"column:InDate"`     //创建时间
	EditDate  int64  `json:"inDate" gorm:"column:EditDate"`   //修改时间
	tableName string `gorm:"-"`                               //自定义表名()
}

//待定
//func (this *Model) TableName() string {
//	if len(this.tableName) != 0 {
//		return this.tableName
//	}
//	return ""
//}

//添加创建时间
func (this *Model) CreateDate() {
	t := time.Now().Unix()
	this.InDate = t
	this.EditDate = t
}

//添加修改时间
func (this *Model) UpdateDate() {
	t := time.Now().Unix()
	this.EditDate = t
}
